package org.kfive.nova.io.grizzly.echo;

import org.glassfish.grizzly.filterchain.BaseFilter;
import org.glassfish.grizzly.filterchain.FilterChainContext;
import org.glassfish.grizzly.filterchain.NextAction;

import java.io.IOException;

/**
 * TODO
 *
 * @author zhanwu.lzw
 * @date 2018年01月25日 14:07
 */
public class EchoFilter extends BaseFilter{
    @Override
    public NextAction handleRead(FilterChainContext ctx) throws IOException {
        final Object peerAddress = ctx.getAddress();
        final Object message = ctx.getMessage();
        ctx.write(peerAddress,message,null);
        return ctx.getStopAction();
    }
}
